#!/bin/bash

# XXL-Job Admin 登录配置
BASE_URL="http://172.16.13.96:9090/xxl-job-admin"
LOGIN_ENDPOINT="${BASE_URL}/login"
COOKIE_FILE="cookies.txt"

# 登录凭据
USERNAME="abtnet"
PASSWORD="Abt@Admin@123"

# 发送登录请求并保存Cookie
echo "正在登录 XXL-Job Admin..."
curl -X POST "${LOGIN_ENDPOINT}" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "userName=${USERNAME}&password=${PASSWORD}" \
  -c "${COOKIE_FILE}" \
  -s -o /dev/null && echo "登录成功，Cookie已保存至 ${COOKIE_FILE}" || echo "登录失败"